﻿Imports Q2Q.UI

Namespace Cues.Helpers

    Public Class Paste
        Public Shared Sub PasteCueData(cue As Cues.CueBase, list As List(Of Cues.CueBase))
            Try
                If cue.GetType Is GetType(Cues.Audio) Then
                    Dim pw As New UI.PasteDialog(Q2Q.Cues.Types.Audio)
                    pw.Owner = Window.GetWindow(My.Application.MainWindow)
                    pw.ShowDialog()

                    If pw.DialogResult = False Then
                        Return
                    End If

                    For Each c In list
                        If c.GetType Is GetType(Cues.Audio) Then
                            With CType(c, Cues.Audio)
                                If pw.AudioNotes.IsChecked Then
                                    CType(c, Cues.CueBase).Description = cue.Description
                                End If
                                If pw.AudioPostAction.IsChecked Then
                                    CType(c, Cues.CueBase).TransportAction = cue.TransportAction
                                End If
                                If pw.AudioDelay.IsChecked Then
                                    CType(c, Cues.CueBase).ActionDelay = cue.ActionDelay
                                End If
                                If pw.FadeIn.IsChecked Then
                                    .FadeInDuration = CType(cue, Audio).FadeInDuration
                                End If
                                If pw.FadeOut.IsChecked Then
                                    .FadeOutDuration = CType(cue, Audio).FadeOutDuration
                                End If
                                If pw.Volume.IsChecked Then
                                    .Volume = CType(cue, Audio).Volume
                                End If
                                If pw.Pan.IsChecked Then
                                    .Pan = CType(cue, Audio).Pan
                                End If
                            End With
                        ElseIf c.GetType Is GetType(Cues.Transport) Then
                            If pw.AudioNotes.IsChecked Then
                                CType(c, Cues.CueBase).Description = cue.Description
                            End If
                            If pw.AudioPostAction.IsChecked Then
                                CType(c, Cues.CueBase).TransportAction = cue.TransportAction
                            End If
                            If pw.AudioDelay.IsChecked Then
                                CType(c, Cues.CueBase).ActionDelay = cue.ActionDelay
                            End If
                        ElseIf c.GetType Is GetType(Cues.Stack) Then
                            If pw.StackNotes.IsChecked Then
                                CType(c, Cues.CueBase).Description = cue.Description
                            End If
                            If pw.StackPostAction.IsChecked Then
                                CType(c, Cues.CueBase).TransportAction = cue.TransportAction
                            End If
                            If pw.StackDelay.IsChecked Then
                                CType(c, Cues.CueBase).ActionDelay = cue.ActionDelay
                            End If
                        End If
                    Next
                ElseIf cue.GetType Is GetType(Cues.Transport) Then
                    Dim pw As New PasteDialog(Q2Q.Cues.Types.Transport)
                    pw.Owner = Window.GetWindow(My.Application.MainWindow)
                    pw.ShowDialog()
                    If pw.DialogResult = False Then
                        Return
                    End If
                    For Each c As Cues.CueBase In list
                        If c.GetType Is GetType(Cues.Audio) Then
                            With CType(c, Cues.Audio)
                                If pw.TransportNotes.IsChecked Then
                                    CType(c, Cues.CueBase).Description = cue.Description
                                End If
                                If pw.TransportPostAction.IsChecked Then
                                    CType(c, Cues.CueBase).TransportAction = cue.TransportAction
                                End If
                                If pw.TransportDelay.IsChecked Then
                                    CType(c, Cues.CueBase).ActionDelay = cue.ActionDelay
                                End If
                            End With
                        ElseIf c.GetType Is GetType(Cues.Transport) Then
                            With CType(c, Cues.Transport)
                                If pw.TransportNotes.IsChecked Then
                                    CType(c, Cues.CueBase).Description = cue.Description
                                End If
                                If pw.TransportPostAction.IsChecked Then
                                    CType(c, Cues.CueBase).TransportAction = cue.TransportAction
                                End If
                                If pw.TransportDelay.IsChecked Then
                                    CType(c, Cues.CueBase).ActionDelay = cue.ActionDelay
                                End If
                                If pw.CueAction.IsChecked Then
                                    .Action = CType(cue, Transport).Action
                                End If
                                If pw.TargetCue.IsChecked Then
                                    .TargetCue = CType(cue, Transport).TargetCue
                                End If
                            End With
                        ElseIf c.GetType Is GetType(Cues.Stack) Then
                            If pw.StackNotes.IsChecked Then
                                CType(c, Cues.CueBase).Description = cue.Description
                            End If
                            If pw.StackPostAction.IsChecked Then
                                CType(c, Cues.CueBase).TransportAction = cue.TransportAction
                            End If
                            If pw.StackDelay.IsChecked Then
                                CType(c, Cues.CueBase).ActionDelay = cue.ActionDelay
                            End If
                        End If
                    Next
                ElseIf cue.GetType Is GetType(Cues.Stack) Then

                    Dim pw As New PasteDialog(Q2Q.Cues.Types.Stack)
                    pw.Owner = Window.GetWindow(My.Application.MainWindow)
                    pw.ShowDialog()
                    If pw.DialogResult = False Then
                        Return
                    End If
                    For Each c As Cues.CueBase In list
                        If pw.StackNotes.IsChecked Then
                            CType(c, Cues.CueBase).Description = cue.Description
                        End If
                        If pw.StackPostAction.IsChecked Then
                            CType(c, Cues.CueBase).TransportAction = cue.TransportAction
                        End If
                        If pw.StackDelay.IsChecked Then
                            CType(c, Cues.CueBase).ActionDelay = cue.ActionDelay
                        End If
                        If pw.CueList.IsChecked Then
                            CType(c, Cues.Stack).CueList = CType(cue, Stack).CueList
                        End If
                    Next
                End If
            Catch ex As Exception
                My.Application.Show.Console.SendMessage("There was a problem pasting data.", ex)
            End Try
        End Sub
    End Class

End Namespace